﻿using Forum.ValidationAttributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Forum.Models
{
    public class RegisterModel : Forum.ValidationAttributes.IsUsernameInDatabase
    {
        [IsUsernameInDatabase(ErrorMessage = "Username is busy")]
        [Required]
        [RegularExpression("[a-zA-Z][a-zA-Z0-9]{5,31}", ErrorMessage = "Invalid username")]
        public string Username
        {
            get;
            set;
        }
        [Required]
        [DataType(DataType.Password)]
        public string Password
        {
            get;
            set;
        }
        [Required]
        [Compare("Password", ErrorMessage = "The Password and ConfirmPassword fields don't match")]
        [DataType(DataType.Password)]
        public string ConfirmPassword
        {
            get;
            set;
        }
        [Required]
        public string FirstName
        {
            get;
            set;
        }
        [Required]
        public string LastName
        {
            get;
            set;
        }
        [Required]
        public int Age
        {
            get;
            set;
        }
    }
}